package com.java.exer1;

/**
 * 圆形类
 *
 * @author shkstart
 * @create 2021-01-12 19:12
 */
public class Circle extends Shape {
    private double radius;

    public Circle(double radius) {
        this.radius = radius;
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    @Override
    public double area() {
        return Double.parseDouble(String.format("%.2f", 2 * Math.PI * radius * radius));
    }

    @Override

    public double perimeter() {
        return Double.parseDouble(String.format("%.2f", 2 * Math.PI * radius));
    }

    @Override
    public String toString() {
        return "圆:" + "\t\t" + "周长" + perimeter() + "\t" + "面积" + area();
    }
}
